
case class RoleRow(id: Int, name: String, code: String, description: Option[String] = None)

case class UserRow(id: Int, erp: String, username: String, organization: Option[String] = None, isEnabled: Boolean = true)

class UserJoinRole(id: Int, erp: String, username: String, organization: Option[String] = None, isEnabled: Boolean = true, roles: Seq[RoleRow]) {
  def this(user: UserRow, roles: Seq[RoleRow]) = this(user.id, user.erp, user.username, user.organization, user.isEnabled, roles)
}


object UserJoinRole extends App {

  println(new UserJoinRole(1, "yuhui", "余辉", Some("cloud"), true, Seq(RoleRow(1, "admin", "admin"))))

  val user = UserRow(1, "yuhui", "余辉", Some("cloud"), true)
  val role = RoleRow(1, "admin", "admin")
  println(new UserJoinRole(user, Seq(role)))

}

